#include "AccessLevelBuilder.h"

#include "ScriptCompiler/ScriptFileContext.h"

CAccessLevelBuilder::CAccessLevelBuilder(std::shared_ptr<CScriptFileContext> InContext)
{
    Context = InContext;
    Result = std::make_shared<CAccessLevelNode>(Context);
}

bool CAccessLevelBuilder::ReadCurentToken()
{
    auto Token = Context->GetCurrentToken();

    switch(Token->Type)
    {
        case EScriptTokenType::Private:
        case EScriptTokenType::Public:
        case EScriptTokenType::Protected:
        case EScriptTokenType::Internal:
        {
            Result->AccessLevel.Add(Token);
            Context->CurrentTokenIndex++;
            return true;
        }

        default:
        {
            Context->RaiseError(10002,Token,U"Expected public/private/protected/internal token");
            return false;
        }
    };

}